<template>
    <div class="">
        <el-row type="flex" class="row-bg" justify="space-between">
            <!--<el-col :span="12">-->
            <!--</el-col>-->
            <el-col :span="6">
                <el-input placeholder="关键字..." size="small" v-model="searchKey">
                    <el-button slot="append" icon="search" @click="loadData"></el-button>
                </el-input>
            </el-col>
        </el-row>
        <template>
            <el-table :data="tableData" border style="width: 100%; text-align: center;margin-top:10px;" v-loading.body="loading" @selection-change="handleSelectionChange">
                <el-table-column type="index" style="width:50%"></el-table-column>
                <el-table-column type="selection"></el-table-column>

                <el-table-column prop="Count" header-align="center" label="奖励数"></el-table-column>
                <el-table-column prop="createTime" header-align="center" label="创建时间"></el-table-column>
                <el-table-column prop="rewardName" header-align="center" label="收益人"></el-table-column>
                <el-table-column prop="sourceName" header-align="center" label="来源人"></el-table-column>
                <el-table-column prop="rewardWay" header-align="center" label="奖励产生方式">
                    <template slot-scope="scope">
                        <span v-text="checkRegType(scope.row.rewardWay)"></span>
                    </template>
                </el-table-column>
            </el-table>
            <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[5,10,20,40]" :page-size="limit" layout="total, sizes, prev, pager, next, jumper" :total="total">
            </el-pagination>
        </template>
    </div>
</template>
<script>
	var qs = require('qs')
	import Editor from '../../components/editor.vue'
	import { tokenGet, TokenUrl, tokenPost } from '../../api/token.js'
	export default {
		data() {
			return {
				checked: true,
				tableData: [],
				currentPage: 1,
				radio: {
					radioC: '1', //是否可以充值
					radioT: '1', //是否可以提现
					radioD: '1', //充值是否到账
					radioB: '1', //虚拟币类型
					radioY: '1', //是否以太坊
					radioZ: '1', //状态
				},
				typeNumber: [],
				total: 0,
				limit: 10,
				searchKey: '',
				loading: false,
				jinyong: [], //禁用id
			}
		},
		methods: {
			handleSizeChange(val) {
				console.log(val)
				this.limit = val
				this.loadData()
			},
			handleCurrentChange(val) {
				console.log(val)
				this.currentPage = val
				this.loadData()
			},
			handleSelectionChange(val) {
				this.typeNumber = val
				this.jinyong = val
				console.log(this.typeNumber)
			},
			/**
			 * @Description: ${获取表格数据}
			 * @Param
			 * @Return
			 * @Author 焦政
			 * @Date 2018/11/14
			 * @Version 1.0
			 */
			loadData() {
				this.loading = true;
				tokenPost(TokenUrl.shifangList, {offset: this.limit*(this.currentPage - 1), limit: this.limit, searchKey: this.searchKey,type:4}).then((response) => {
					console.log(response)
					this.tableData = response.data.data.rows;
					this.total = response.data.data.total;
					this.loading = false;
				}, (response) => {

				});
			},
			//会员类型判断
			checkMemberType(s) {
				if (s == 0) {
					return '普通会员'
				} else if (s == 1) {
					return '销售商'
				} else if (s == 2) {
					return '生产商'
				}
			},
			// 奖励产生方式
			checkRegType(t) {
				if (t == 1) {
					return '认购'
				} else if (t == 2) {
					return '对冲'
				}else if (t == 3) {
					return '复投'
				}else if (t == 4) {
					return '加速奖励'
				}else if (t == 5) {
					return '每日释放'
				}
			},
			// ============================================表格数据状态类型判断👆==============================================//
		},

		//引入文本编辑器那个组件
		components: {
			'v-editor': Editor,
		},
		created() {
			this.loadData()
		},
	}
</script>
<style>
    .el-dialog--small {
        width: 60%;
    }
</style>
